<?php
/**
 * Created by ljhint on 2020/8/14.
 */

namespace App\Http\Middleware;

use Closure;

class SiteSettings
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (!$request->session()->has('configuration')){
            $configuration = \App\Models\Configuration::pluck('val','key');
            $request->session()->put('configuration',$configuration);
        }
        return $next($request);
    }
}
